<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/user/change-password.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/jquery-ui.js');
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/jquery-ui.css');
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/user/user.css');
?>

<?php
$this->breadcrumbs = array(
    'Users' => array('index'),
    $model->id,
);

$this->menu = array(
    array('label' => 'List User', 'url' => array('index'), 'visible' => Yii::app()->user->checkAccess("admin")),
    array('label' => 'Create User', 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess("admin")),
    array('label' => 'Update User', 'url' => array('update', 'id' => $model->id), 'visible' => Yii::app()->user->checkAccess("admin")),
    array('label' => 'Delete User', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?'), 'visible' => Yii::app()->user->checkAccess("SUPPERADMIN")),
    array('label' => 'Manage User', 'url' => array('admin'), 'visible' => Yii::app()->user->checkAccess("SUPPERADMIN")),
);
?>
<!--update password massage-->
<div class="alert in alert-block fade alert-success" style="display: none;">
    '<strong>Congratulation !!</strong> You password updated successfully!!.
</div>

<div class="alert in alert-block fade alert-error" style="display: none;">
    '<strong>Oh snap!</strong> Try again!!.
</div>
<!--end update password massage-->

<!-- user create success massage-->

<?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="alert in alert-block fade alert-success">
        <?php echo Yii::app()->user->getFlash('success'); ?>
    </div>
<?php endif; ?>

<!-- end user create massage-->
<h1> User Profile</h1>
<div class="change-passwoed-link"> <?php echo CHtml::link('Change Password', array('#'), array('class' => 'change_psw')); ?></div>

<?php
$this->widget('zii.widgets.CDetailView', array(
    'data' => $model,
    'attributes' => array(
        'first_name',
        'middle_name',
        'last_name',
        'username',
        'email',
        array(
            'name' => 'picture',
            'type' => 'raw',
            'value' => CHtml::image(($model->picture) ? Yii::app()->getBaseUrl(true) .DIRECTORY_SEPARATOR. Yii::app()->params['imageSavePath'] . $model->picture : Yii::app()->getBaseUrl(true) .DIRECTORY_SEPARATOR. Yii::app()->params['imageSavePath'] . 'default.jpg', "image", array("width" => 128)),
        ),
        'birthday',
        'country',
        'address',
        'tele',
        'fax',
        'web',
    ),
));
?>
<div id="updatePassword-form" title="Reset Password form">

    <fieldset>
        <?php
        $form = $this->beginWidget('CActiveForm', array(
            'id' => 'updatePassword-form',
            'enableAjaxValidation' => FALSE,
                ));
        ?>
        <p class="validateTips"></p>
        <?php
        echo Chtml::label('Enter new password', '', array('wrapInput' => true));
        echo Chtml::passwordField('new_password', '', array('id' => "new-password", 'class' => "text ui-widget-content ui-corner-all"));

        echo Chtml::label('Re-Enter new password', '', array('wrapInput' => true));
        echo Chtml::passwordField('repeatenew_password', '', array('id' => "repeatenew-password", 'class' => "text ui-widget-content ui-corner-all"));
        echo Chtml::hiddenField('user_id', $_GET['id'], array('id' => 'user_id'));
        ?>


        <?php $this->endWidget(); ?> 
    </fieldset>
</div>